package com.example.opengl.render.triangle

import android.os.Build
import androidx.annotation.RequiresApi
import com.alibaba.android.arouter.facade.annotation.Route
import com.android.baselibrary.base.BaseActivity
import com.example.opengl.R
import com.example.opengl.databinding.ActivityOpenglRenderTriangleBinding
import com.example.opengl.main.OpenGLPath
import com.example.opengl.render.base.Drawer

/**
 * 绘制三角形
 */
@Route(path = OpenGLPath.OPENGL_RENDER_TRIANGLE)
class OpenGlRenderTriangleActivity : BaseActivity<ActivityOpenglRenderTriangleBinding>() {
    override fun getLayoutId(): Int = R.layout.activity_opengl_render_triangle

    @RequiresApi(Build.VERSION_CODES.O)
    override fun initView() {
        val triangleDrawer1 = TriangleDrawer(Drawer.point)
        val triangleDrawer2 = TriangleDrawer(Drawer.line)
        val triangleDrawer3 = TriangleDrawer(Drawer.triangle)
        val triangleRender = TriangleRender()
        triangleRender.addDrawerRender(triangleDrawer1)
        triangleRender.addDrawerRender(triangleDrawer2)
        triangleRender.addDrawerRender(triangleDrawer3)
        mBinding.surface.setEGLContextClientVersion(2)
        mBinding.surface.setRenderer(triangleRender)


    }

    override fun initListener() {

    }
}